export const schema = {
    type: "page",
    title: "创建团队",
    toolbar: {
        type: "button",
        actionType: "submit",
        label: "保存",
        icon: "fa fa-save pull-left",
        level: "primary",
        target: "teamcreateform"
    },
    body: {
        api: "post:/api/team",
        redirect: "/team/list",
        submitText: "",
        name: "teamcreateform",
        type: "form",
        title: "",
        mode: "horizontal",
        actions: [
            {
                type: "button",
                actionType: "submit",
                label: "保存",
                icon: "fa fa-save pull-left",
                level: "primary",
                target: "teamcreateform"
            }
        ],
        controls: [
            {
                type: "select",
                name: "org_id",
                label: "所属机构",
                source: "/api/org/sug?_=${_}",
                required: true,
                visibleOn: "!data.query.org_id && !acl.can('skip:select-org')",
                inline: true
            },

            {
                type: "divider",
                visibleOn: "!data.query.org_id && !acl.can('skip:select-org')"
            },

            {
                type: "select",
                name: "parent_id",
                label: "上级团队",
                clearable: true,
                autoComplete: "/api/team/sug?term=${term}&org_id=${org_id}",
                cache: false,
                desc: '可不选，不选则创建顶级团队',
                inline: true
            },



            {
                type: "divider"
            },

            {
                type: "text",
                name: "name",
                label: "团队名称",
                required: true
            },

            {
                type: "divider"
            },

            {
                type: "select",
                name: "type",
                label: "团队类型",
                required: true,
                source: "/api/setting/team_type"
            },

            {
                type: "divider"
            },

            {
                type: "checkboxes",
                columnsCount: 4,
                name: "service_target",
                label: "服务对象",
                required: true,
                source: "/api/setting/service_target"
            },

            {
                type: "divider"
            },

            [
                {
                    type: "text",
                    name: "contact_name",
                    label: "联系人",
                    required: true
                },

                {
                    type: "text",
                    name: "contact_phone",
                    label: "联系电话",
                    validations: 'isTelOrPhone',
                    required: true
                }
            ],

            {
                type: "divider"
            },

            {
                type: "text",
                name: "contact_email",
                label: "邮箱",
                validations: 'isEmail',
                required: true
            },

            {
                type: "divider"
            },

            {
                type: "region",
                name: "address",
                label: "团队地址",
                required: true
            },

            {
                type: "divider"
            },

            {
                type: "text",
                name: "slogan",
                label: "团队口号",
                value: "文明城市同创，志愿服务同行",
                maxLength: 20
            },

            {
                type: "divider"
            },

            {
                type: "textarea",
                name: "abstract",
                label: "团队简介",
                required: true,
                maxLength: 200
            },

            {
                type: "divider"
            },

            [
                {
                    type: "text",
                    name: "username",
                    label: "帐号",
                    validations: 'isAlphanumeric,minLength:6',
                    required: true
                },

                {
                    type: "password",
                    name: "pwd",
                    label: "密码",
                    validations: 'minLength:6',
                    required: true
                }
            ],

            {
                type: "divider"
            },

            {
                type: "image",
                name: "logo",
                label: "Logo",
                // accept: "image/png,image/jpeg",
                maxSize: 10 * 1024 * 1024,
                desc: '请选择 jpg 或者 png 图片，单个文件请不要超过 10M，建议尺寸比例：（60 x 60）。',
                limit: {
                    minWidth: 60,
                    minHeight: 60,
                    maxwidth: 900,
                    maxHeight: 900
                }
            },

            {
                type: "divider"
            },

            {
                type: "image",
                name: "certificate_photo",
                // accept: "image/png,image/jpeg",
                label: "上传资质",
                maxSize: 10 * 1024 * 1024,
                desc: '上传资质文件做个说明，请选择 jpg 或者 png 图片，单个文件请不要超过 10M，最多可上传5张。建议尺寸比例：（750 x 440）。',
                multiple: true,
                maxLength: 5
            },
            {
                type: "divider"
            },

            {
                type: "image",
                name: "team_photo",
                // accept: "image/png,image/jpeg",
                label: "上传团队照片",
                maxSize: 10 * 1024 * 1024,
                desc: '请选择 jpg 或者 png 图片，单个文件请不要超过 10M，最多可上传5张。建议尺寸比例：（750 x 440）。',
                multiple: true,
                maxLength: 5
            },


            {
                type: "divider"
            },
            {
                type: "checkboxes",
                name: "acl",
                label: "权限配置",
                value: "owner-subteam",
                visibleOn: 'acl.can("project:verify")&&acl.can("score_mall:merchant")',
                options: [
                    {
                        label: "发布商品",
                        value: "auth-create-goods",
                    },
                    {
                        label: "项目免审权",
                        value: "project-skip-verify"
                    },
                    {
                        label: "拥有子团队权",
                        value: "owner-subteam"
                    }
                ]
            },
            {
                type: "checkboxes",
                name: "acl",
                label: "权限配置",
                value: "owner-subteam",
                visibleOn: 'acl.can("project:verify")&&!acl.can("score_mall:merchant")',
                options: [
                    {
                        label: "项目免审权",
                        value: "project-skip-verify"
                    },
                    {
                        label: "拥有子团队权",
                        value: "owner-subteam"
                    }
                ]
            },

            {
                type: "checkboxes",
                name: "acl",
                label: "权限配置",
                value: "owner-subteam",
                visibleOn: '!acl.can("project:verify")',
                options: [
                    {
                        label: "项目免审权",
                        value: "project-skip-verify",
                        disabled: true
                    },
                    {
                        label: "拥有子团队权",
                        value: "owner-subteam"
                    }
                ]
            }
        ]
    }
};
